package org.whatever.aha.zjut.platform.service.schema;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.whatever.aha.zjut.platform.entity.schema.ApplicationSchema;
import org.whatever.aha.zjut.platform.mapper.schema.ApplicationSchemaMapper;
import org.whatever.aha.zjut.platform.vo.PageVo;

import java.util.List;

/**
 * @author Vc
 * @version 1.0
 * @Desc
 * @date 2021/12/19 16:24
 */
@Service
@RequiredArgsConstructor
public class ApplicationSchemaService {
    final ApplicationSchemaMapper applicationSchemaMapper;

    /**
     * 分页查询记录
     *
     * @param appid
     * @param pageNum
     * @param pageSize
     * @return
     */
    public PageVo<List<ApplicationSchema>> getProjectAppJudgePagable(int appid, int pageNum, int pageSize) {

        Page<ApplicationSchema> projectPage = applicationSchemaMapper.selectPage(new Page<>(pageNum, pageSize), new QueryWrapper<ApplicationSchema>().eq("as_app_id" , appid));
        return new PageVo<>(projectPage.getCurrent(), projectPage.getSize(),projectPage.getRecords(), projectPage.getTotal());
    }
}
